<template>
  <div id="app">
    <van-button @click="fetchData">获取用户信息</van-button>
    <pre>{{ responseData }}</pre>
  </div>
</template>

<script>
import { rq } from './request';
import { Button } from 'vant';

export default {
  name: 'App',
  components: {
    [Button.name]: Button,
  },
  data() {
    return {
      responseData: null,
    };
  },
  methods: {
    async fetchData() {
      try {
        const response = await rq('/inthepink/myUser', 'GET');
        this.responseData = response;
        console.log('响应结果:', response);
      } catch (error) {
        console.error('请求失败:', error);
      }
    },
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 10px;
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 4px;
}
</style>
   